package ${packageName}.service.impl;


import ${packageName}.entity.vo.${entityName}Vo;
import com.retail.core.entity.ParamReq;
import ${packageName}.entity.request.${entityName}Request;
import ${packageName}.mapper.${entityName}Mapper;
import ${packageName}.service.${entityName}Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
* ${codeGenComment} Service impl
* @author Administrator
*/
@Service
public class ${entityName}ServiceImpl implements ${entityName}Service {

   @Resource
   private ${entityName}Mapper ${lowerEntityName}Mapper;

   @Override
   public ${entityName}Vo getModel(Long id) {
      return  ${lowerEntityName}Mapper.getModel(id);
   }

   @Transactional
   @Override
   public Long save(${entityName}Request ${lowerEntityName}Request) {
      ${lowerEntityName}Mapper.save(${lowerEntityName}Request);
      return ${lowerEntityName}Request.getId();
   }

   @Transactional
   @Override
   public Long update(${entityName}Request ${lowerEntityName}Request) {
      ${lowerEntityName}Mapper.update(${lowerEntityName}Request);
      return ${lowerEntityName}Request.getId();
   }

   @Override
   public List<${entityName}Vo> listPage(ParamReq<${entityName}Request> params) {
      params.setStartIndex((params.getCurrent() -1 ) * params.getSize());
      return ${lowerEntityName}Mapper.listPage(params);
   }

   @Override
   public Integer countPage(ParamReq<${entityName}Request> params) {
       return ${lowerEntityName}Mapper.countPage(params);
   }

   @Override
   public Integer updateDelFlagById(Long id, Integer delFlag) {
       return ${lowerEntityName}Mapper.updateDelFlagById(id, delFlag);
   }
}
